/*
   This file is part of the 'Let's Do Stuff Together' project
   http://code.google.com/p/dostufftogether/

   Copyright 2010 Christoph Fuchs, Stefan Thaler

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
package com.appspot.android2gather.shared;

import java.util.ArrayList;
import java.util.Arrays;

import com.appspot.android2gather.activity.Activity;
import com.google.appengine.api.datastore.Category;
import com.google.appengine.api.users.User;


/**
 * Simple implementation of the shared activity interface. Necessary to deserialize the json response.
 * Response object only. To create one, update or modify one send an appropriate  message to the server.
 * 
 * @author Christoph 'Gigi' Fuchs
 *
 */
public class ActivityImpl implements Activity{

	/**
	 * 
	 */
	private Double altitude;
	public void setCreator(User creator) {
		this.creator = creator;
	}

	private String description;
	private Long endTime;
	private Long id;
	private Double latitude;
	private Double longitude;
	private Long startTime;
	private String name;
	private User[] attendees;
	private Category[] categories;
	private ArrayList<User> attendeeList;
	private ArrayList<Category> categoryList;
	private User creator;
	private String facebookEventId;
	
	
	
	
	@Override
	public Double getAltitude() {
		return altitude;
	}

	@Override
	public String getDescription() {
		return description;
	}

	@Override
	public Long getEndTime() {
		return endTime;
	}

	@Override
	public Long getId() {
		return id;
	}

	@Override
	public Double getLatitude() {
		return latitude;
	}

	@Override
	public Double getLongitude() {
		return longitude;
	}

	@Override
	public Long getStartTime() {
		return startTime;
	}

	@Override
	public String getName() {
		return name;
	}

	public void setAltitude(Double altitude) {
		this.altitude = altitude;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setEndTime(Long endTime) {
		this.endTime = endTime;
	}

	public void setId(Long activityId) {
		this.id = activityId;
	}

	public void setLatitude(Double latitude) {
		this.latitude = latitude;
	}

	public void setLongitude(Double longitude) {
		this.longitude = longitude;
	}

	public void setStartTime(Long startTime) {
		this.startTime=startTime;

	}

	public void setName(String activityName) {
		this.name = activityName;
	}

	@Override
	public Integer getNumberOfAttendees() {
		return getAttendees().size();
	}

	@Override
	public ArrayList<Category> getCategories() {
		if (categoryList==null)
			{
			new ArrayList<Category>(Arrays.asList(categories));
			}
		return this.categoryList;
	}

	@Override
	public ArrayList<User> getAttendees() {
		if (this.attendeeList==null) 
		{
			this.attendeeList=  new ArrayList<User>(Arrays.asList(attendees));
		}
		return this.attendeeList;
	}

	public void setAttendees(User[] attendees) {
		this.attendees =attendees;
	}

	public void setCategories(Category[] categories) {
		this.categories =  categories;;
	}
	
	@Override
	public User getCreator() {
		
		return  this.creator;
	}

	public void setFacebookEventId(String facebookEventId) {
		this.facebookEventId = facebookEventId;
	}

	public String getFacebookEventId() {
		return facebookEventId;
	}
	
}
